package cl.xintec.utils.presentation
{
	import flash.utils.getDefinitionByName;
	import flash.utils.getQualifiedClassName;
	
	import mx.controls.ComboBox;
	
	public class TranslatorGroup10
	{
		public function TranslatorGroup10()
		{
		}

		private static function changeComboBox(cbx:Object, val:String, keyLabel:String):int {
			
			for (var i: int = 0; i < cbx.length; i++) {
				var className:String = getQualifiedClassName(cbx[i]);
				var refClass:Class = getDefinitionByName(className) as Class;
				var instance:Object = new refClass();
				instance = cbx[i];
				var params:Array = null;
				var id:String = instance[keyLabel];
				
			    if ( val == id) {
			       return i;
			    }
		    }
		    return -1;  
		 }
		 
		 public static function executeTranslator(text:String, cb:ComboBox, keyLabel:String):void {
		 	cb.selectedIndex=changeComboBox(cb.dataProvider, text, keyLabel);
		 }	        	        


	}
}